part of '../../repository.dart';

const _kGooglePlayPurchasedItemOtherRevocationReasonValue = 'other';
const _kGooglePlayPurchasedItemRemorseRevocationReasonValue = 'remorse';
const _kGooglePlayPurchasedItemNotReceivedPurchaseRevocationReasonValue = 'not_received_purchase';
const _kGooglePlayPurchasedItemDefectivePurchaseRevocationReasonValue = 'defective_purchase';
const _kGooglePlayPurchasedItemAccidentalPurchaseRevocationReasonValue = 'accidental_purchase';
const _kGooglePlayPurchasedItemFraudRevocationReasonValue = 'fraud';
const _kGooglePlayPurchasedItemFriendlyFraudRevocationReasonValue = 'friendly_fraud';
const _kGooglePlayPurchasedItemChargebackRevocationReasonValue = 'chargeback';

class _GooglePlayTransactionRevocationReasonDto extends Equatable {
  const _GooglePlayTransactionRevocationReasonDto._internal({
    required this.reasonString,
  });

  final String reasonString;

  @override
  List<Object?> get props {
    return [
      reasonString,
    ];
  }

  factory _GooglePlayTransactionRevocationReasonDto.fromString(String reasonString) {
    return _GooglePlayTransactionRevocationReasonDto._internal(
      reasonString: reasonString,
    );
  }

  GooglePlayTransactionRevocationReason toEntity() {
    return switch (reasonString) {
      _kGooglePlayPurchasedItemOtherRevocationReasonValue =>
        GooglePlayTransactionRevocationReason.other,
      _kGooglePlayPurchasedItemRemorseRevocationReasonValue =>
        GooglePlayTransactionRevocationReason.remorse,
      _kGooglePlayPurchasedItemNotReceivedPurchaseRevocationReasonValue =>
        GooglePlayTransactionRevocationReason.notReceivedPurchase,
      _kGooglePlayPurchasedItemDefectivePurchaseRevocationReasonValue =>
        GooglePlayTransactionRevocationReason.defectivePurchase,
      _kGooglePlayPurchasedItemAccidentalPurchaseRevocationReasonValue =>
        GooglePlayTransactionRevocationReason.accidentalPurchase,
      _kGooglePlayPurchasedItemFraudRevocationReasonValue =>
        GooglePlayTransactionRevocationReason.fraud,
      _kGooglePlayPurchasedItemFriendlyFraudRevocationReasonValue =>
        GooglePlayTransactionRevocationReason.friendlyFraud,
      _kGooglePlayPurchasedItemChargebackRevocationReasonValue =>
        GooglePlayTransactionRevocationReason.chargeback,
      _ => throw UnimplementedError(),
    };
  }
}
